package com.zrrd.learn.exam;

/**
 * @author wrn
 * @version 1.0
 * @date 2023/8/31 14:10
 */

public class test20230831_05 {

    /**
     * 统计1~100之间出现了几次数字9
     *
     * @param args
     */
    public static void main(String[] args) {
        int a = 0;
        int b = 0;
        int c = 0;
        int count = 0;
        for (int i = 1; i < 101; i++) {
            a=i/100;
            b=i/10%10;
            c=i%10;
            if (a/9==1){
                count+=1;
            }
            if (b/9==1){
                count+=1;
            }
            if (c/9==1){
                count+=1;
            }
        }
        System.out.println("1~100之间出现了 "+count+" 次数字9");

    }

}
